﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<section class="container-fluid m15_t">
    <div class="data-wrap case">
        <div class="data-tool clearfix">
            <div class="pull-left form-inline ">

            </div>
            <div class="pull-right">
                <form class="form-inline" id="formSearch">
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">权限代码：</label>
                        <input class="form-control" name="code" type="text" autocomplete="off">
                    </div>

                    <button type="button" class="btn btn-default btn-sm active" id="btnSearch"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                </form>
            </div>
        </div>
        <table id="logDG"></table>
    </div>
</section>
@section footerScript{
    <script type="text/javascript">

        var datagrid = $("#logDG");

        $(function () {
            Topro.UI.DataAutoHeight();

            doSearch();

            $("#btnSearch").click(function () {
                doSearch();
            });
        });

        function Tip_success(word) {
            Topro.UI.Tip_success(word);
        }

        function doSearch() {
            //固定行
            var columns = [
                [
                    {
                        field: 'message',
                        title: '内容',
                        width: 170,
                        align: 'left',
                    },
                    {
                        field: 'level',
                        title: '级别 ',
                        width: 120,
                        align: 'center',
                        formatter: function (value, row, index) {
                            var result = "";

                            if (!Ims.Util.isNullOrEmptySpance(value)) {
                                result = value;
                            }
                            return result;
                        }
                    },
                    {
                        field: 'source',
                        title: '来源',
                        width: 80,
                        align: 'center',
                    },
                    {
                        field: 'ip',
                        title: 'Ip ',
                        width: 150,
                        align: 'center'
                    },
                    {
                        field: 'createdByString',
                        title: '创建人 ',
                        width: 75,
                        align: 'center',
                    },
                    {
                        field: 'createdDate',
                        title: '创建时间',
                        align: 'center',
                        width: 140,
                        formatter: function (value, row, index) {

                            var result = value.replace("T"," ");

                            return result;
                        }
                    }
                ]
            ];

            Topro.UI.DataGrid(datagrid, {
                fit: true,
                method: "post",
                url: "@Url.Action("LogQuery", "Auth")",
                //queryParams: page.queryParams(),
                idField: 'id',
                pagination: true,
                singleSelect: true,
                rownumbers: true,
                showFooter: true,
                autoEditing:true,
                frozenColumns: null,
                columns: columns
            });
        }
    </script>
}


